﻿using System;
public abstract class UserTest
{
    public abstract void M1();
    public abstract void M2();
    public abstract void M3();
}

public class UserTestImpl : UserTest
{
    public override void M1() => Console.WriteLine("UserTestImpl 实现 M1 方法");
    public override void M2() => Console.WriteLine("UserTestImpl 实现 M2 方法");
    public override void M3() => Console.WriteLine("UserTestImpl 实现 M3 方法");
}
public interface UserService
{
    void Add();
    void Delete();
    void Update();
    void Query();
}

public class UserServiceImpl : UserService
{
    public void Add() => Console.WriteLine("执行添加操作");
    public void Delete() => Console.WriteLine("执行删除操作");
    public void Update() => Console.WriteLine("执行更新操作");
    public void Query() => Console.WriteLine("执行查询操作");
}
public class Student
{
    public string Name { get; set; }
    public void Study() => Console.WriteLine($"{Name}正在学习");
}

public class Father
{
    public virtual void Introduce() => Console.WriteLine("我是父亲");
    public void Work() => Console.WriteLine("父亲在工作");
}

public class Child : Father
{
    public override void Introduce() => Console.WriteLine("我是孩子");
}

public class Son : Child
{
    public override void Introduce() => Console.WriteLine("我是儿子");
    public void Play() => Console.WriteLine("儿子在玩耍");
}

public class Demo
{
    public static void Main(string[] args)
    {
        Console.WriteLine("=== 测试抽象类UserTest ===");
        UserTest userTest = new UserTestImpl();
        userTest.M1();
        userTest.M2();
        userTest.M3();

        Console.WriteLine("\n=== 测试接口UserService ===");
        UserService userService = new UserServiceImpl();
        userService.Add();
        userService.Delete();
        userService.Update();
        userService.Query();

        Console.WriteLine("\n=== 测试上课练习类 ===");
        Student student = new Student { Name = "小明" };
        student.Study();
        Father father = new Father();
        father.Introduce();
        father.Work();

        Child child = new Child();
        child.Introduce();
        child.Work(); 

        Son son = new Son();
        son.Introduce();
        son.Work(); 
        son.Play(); 
    }
}